package com.beiing.tianshuai.tianshuai.mine.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.entity.CodeBean;
import com.beiing.tianshuai.tianshuai.entity.PersonalPublishBean;
import com.beiing.tianshuai.tianshuai.mine.model.PersonalPublishModel;
import com.beiing.tianshuai.tianshuai.mine.model.PersonalPublishModelImpl;
import com.beiing.tianshuai.tianshuai.mine.view.PersonalPublishViewImpl;

/**
 * Created by Administrator on 2017/12/25 0025.
 */

public class PersonalPublishPresenter extends BasePresenter implements PersonalPublishPresenterImpl, PersonalPublishModel.OnPersonalPublishRequestListener {

    private PersonalPublishViewImpl mView;
    private PersonalPublishModelImpl mModel;

    public PersonalPublishPresenter(PersonalPublishViewImpl view) {
        mView = view;
        mModel = new PersonalPublishModel(this);
    }

    @Override
    public void getPersonalPublishData(String uid, int pageSize, int page, int type) {
        mView.showProgress();
        mModel.getPersonalPublishData(uid, pageSize, page, type);
    }

    @Override
    public void getDeleteMyInterestResult(String uid, String vid, int position) {
        mModel.getDeleteMyInterestResult(uid, vid, position);
    }

    @Override
    public void getDeleteMyDiscoveryResult(String id, int position) {
        mModel.getDeleteMyDiscoveryResult(id, position);
    }

    @Override
    public void getDeleteMyActivityResult(String id, int position) {
        mModel.getDeleteMyActivityResult(id, position);
    }

    @Override
    public void onRequestSuccess(PersonalPublishBean bean) {
        mView.hideProgress();
        mView.onRequestSuccess(bean);
    }

    @Override
    public void onRequestError(Throwable throwable) {
        mView.hideProgress();
        mView.onRequestFailed(throwable);
    }

    @Override
    public void onDeleteSuccess(CodeBean bean, int position) {
        mView.onDeleteSuccess(bean, position);
    }

    @Override
    public void onDeleteError(Throwable throwable) {
        mView.onDeleteError(throwable);
    }
}
